package com.jinke.api.common.annotation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @projectName:
 * @title: AtLeastOneNotNull
 * @description: 自定义校验注解 校验两个参数不能同时为空
 * @see:
 * @author: hhp
 * @version: 1.0.0
 * @createTime: 2024/7/19 11:02
 */
@Documented
@Constraint(validatedBy = AtLeastOneNotNullValidator.class)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
public @interface AtLeastOneNotNull {
    String message() default "两个参数不能同时为空";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
